package com.project.config;

import com.project.MyTest;
import com.project.dao.IUserDao;
import com.project.dao.impl.UserDaoImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

@Configuration //标识该类为配置类
@ComponentScan("com.project") //扫描指定包，及子包中的spring组件类
//@ComponentScan(basePackageClasses = MyTest.class)//扫描述指定类所在的包，及子包中的spring组件类
public class SpringConfig {

    @Bean("userDao")
    @Scope("prototype")
    public IUserDao getDao(){
        return new UserDaoImpl();
    }
}
